home *** CD-ROM | disk | FTP | other *** search
/ kermit.columbia.edu / kermit.columbia.edu.tar / kermit.columbia.edu / newsgroups / misc.20000824-20010305 / 000294_news@columbia.edu _Thu Feb 15 10:15:35 2001.msg < prev    next >
Internet Message Format  |  2001-03-05  |  4KB

  1. Return-Path: <news@columbia.edu>
  2. Received: from watsun.cc.columbia.edu (watsun.cc.columbia.edu [128.59.39.2])
  3.     by monire.cc.columbia.edu (8.9.3/8.9.3) with ESMTP id KAA10748
  4.     for <kermit.misc@cpunix.cc.columbia.edu>; Thu, 15 Feb 2001 10:15:34 -0500 (EST)
  5. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
  6.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id KAA23260
  7.     for <kermit.misc@watsun.cc.columbia.edu>; Thu, 15 Feb 2001 10:15:34 -0500 (EST)
  8. Received: (from news@localhost)
  9.     by newsmaster.cc.columbia.edu (8.9.3/8.9.3) id JAA14972
  10.     for kermit.misc@watsun.cc.columbia.edu; Thu, 15 Feb 2001 09:59:16 -0500 (EST)
  11. X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
  12. From: fdc@columbia.edu (Frank da Cruz)
  13. Subject: Re: How to Delete files based on date
  14. Date: 15 Feb 2001 14:59:16 GMT
  15. Organization: Columbia University
  16. Message-ID: <96gqs4$ejq$1@newsmaster.cc.columbia.edu>
  17. To: kermit.misc@columbia.edu
  18.  
  19. In article <96gf2f$inb$1@boomer.cs.utexas.edu>,
  20. Logan Shaw <logan@cs.utexas.edu> wrote:
  21. : In article <3A8BB07A.B30F3D1D@eunet.no>,
  22. : Halvor Nyberg  <hnyberg@eunet.no> wrote:
  23. : >Is it possible to delete all files in a directory which is older than
  24. : >today.
  25. : Do you believe that directories become write-protected when they
  26. : are one day old?  That is what your question sounds like.  :-)
  27. : But, I think you mean to ask if there is a way to scan a directory,
  28. : find files which themselves are older than a day, and delete those
  29. : files.  Here is how to do that:
  30. :     cd /directory/name
  31. :     find . -type f -mtime +1 -exec rm {} \;
  32. : This works recursively; it will scan not only files in that directory
  33. : but ones in subdirectories.
  34. It might be somewhat easier to do this with C-Kermit:
  35.  
  36.   http://www.columbia.edu/kermit/ckermit.html
  37.  
  38. Look in the C-Kermit Script Library:
  39.  
  40.   http://www.columbia.edu/kermit/ckscripts.html
  41.  
  42. in the File Management Scripts section.  It really boils down to one
  43. simple command:
  44.  
  45.   delete [options] /before:today *
  46.  
  47. Options may include:
  48.  
  49.  /after:         /except:        /noask          /not-after:
  50.  /ask            /heading        /nodotfiles     /not-before:
  51.  /before:        /larger-than:   /noheading      /simulate
  52.  /dotfiles       /list           /nolist         /smaller-than:
  53.  
  54. The time-oriented options take regular dates and times as arguments
  55. as well as symbolic date-times such as TODAY, TOMORROW, YESTERDAY,
  56. -5DAYS, +3MONTHS, etc, and functions are also provided to do any
  57. desired kind of date arithmetic.  For more info about this, see:
  58.  
  59.   http://www.columbia.edu/kermit/case17.html
  60.  
  61. The file specification ("*" in the example) can be a C-Shell style
  62. pattern for maximum flexibility in file selection, which is further
  63. enhanced by options to include or exclude files based on other
  64. criteria.
  65.  
  66. Later in this thread, the original poster said they did not want
  67. the operation applied recursively.  C-Kermit 7.0 does not delete
  68. recursively.  However, in case you DID want recursive deletion,
  69. C-Kermit 7.1, now in testing:
  70.  
  71.   http://www.columbia.edu/kermit/ck71.html
  72.  
  73. adds this option to the DELETE command:
  74.  
  75.  /after:         /except:        /nodotfiles     /recursive      /type:
  76.  /ask            /heading        /noheading      /simulate
  77.  /before:        /larger-than:   /nolist         /smaller-than:
  78.  /directories    /list           /not-after:     /summary
  79.  /dotfiles       /noask          /not-before:    /tree
  80.  
  81. If you want recursive deletion, include the /RECURSIVE option; if you
  82. don't, omit it.  If you want to delete not only files but also
  83. directories, include /DIRECTORIES; if not, don't include it, etc.
  84.  
  85. If you haven't looked at C-Kermit in a while, you might want to take
  86. another look.
  87.  
  88. - Frank